package com.application.fabric.加密算法;

import org.junit.jupiter.api.Test;

import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

public class javamd5 {
    @Test
    public void md5test() throws NoSuchAlgorithmException {
        String originalString = "Hello, world ifyasiuahdois! 那么中文的可以码";
        MessageDigest md = MessageDigest.getInstance("MD5");
        byte[] digestBytes = md.digest(originalString.getBytes());
        StringBuilder sb = new StringBuilder();
        for (byte b : digestBytes) {
            sb.append(String.format("%02x", b & 0xff));
        }
        System.out.println("MD5 hash: " + sb.toString());
    }
}
